<?php
class RcmsTableDAO extends RCMSDaoBase {
    protected $tables = array();
    
    public function setTableDefinition($columns) {
    	
    }

    public function fetchAllDataByTableName($tableName, $columns, $whereClause, $orderClause, $params){
    	$sql = $this->makeSelectSql($tableName, $columns, $whereClause, $orderClause);
    	return $this->execute($sql, $params)->fetchAll(PDO::FETCH_ASSOC);
    }
    
    public function updateDataByTableName($tableName, $columns, $whereClause, $params){
    	$sql = $this->makeUpdateSql($tableName, $columns, $whereClause);
    	return $this->execute($sql, $params)->fetchAll(PDO::FETCH_ASSOC);
    }
    
    protected function checkTable($tableName) {
    	if (isset($tables[$tableName])) {
    		return;
    	}
    	//TODO
        $stmt = $this->con->query('SELECT * FROM '.$tableName.' WHERE 1=1');
        $columns = array();
        for ($i=0; $i<$stmt->columnCount(); $i++) {
        	$columns[] = $stmt->getColumnMeta($i);
        }
        $stmt->closeCursor();
        $this->tables[$tableName] = $columns;
    }
}
?>
